package com.salon.common.http.response;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.text.SimpleDateFormat;
import java.util.Date;
import lombok.Data;

@Data
@ApiModel
public class BaseResult {

    @ApiModelProperty(value = "状态码", required = true)
    private ResultCode code = ResultCode.SUCCESS;

    @ApiModelProperty(value = "提示信息")
    private String message = "SUCCESS";

    @ApiModelProperty(value = "响应时间", required = true)
    private String timestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());

    public int getCode() {
        return code.getCode();
    }

    public BaseResult() {
    }

    public BaseResult(ResultCode code, String message) {
        this.code = code;
        this.message = message;
    }

    public BaseResult code(ResultCode code, String message) {
        this.code = code;
        this.message = message;
        return this;
    }

    public BaseResult message(String message) {
        this.message = message;
        return this;
    }

}
